package com.wgu.modules.web;

import com.wgu.common.global.Result;
import com.wgu.modules.dto.TypeDTO;
import com.wgu.modules.service.TypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 书籍类型控制器
 * @Author: w
 * @Date: 2019/7/1 15:38
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/type")
@Api(tags = "书籍类型模块", description = "此模块对所有书籍类型查询")
public class TypeController {
    @Resource
    private TypeService typeService;

    @PostMapping("/save")
    @ApiOperation(value = "新增书籍类型==》前台暂不支持")
    public Result save(@RequestBody TypeDTO typeDTO){
        //typeService.save(typeDTO);
        return Result.ok();
    }

    @GetMapping("/list")
    @ApiOperation(value = "查询所有书籍类型 暂无条件查询，即不需要填条件")
    public Result list(){
        return Result.ok(typeService.getsType());
    }

    @GetMapping("/listParent")
    @ApiOperation(value = "查询父类书籍类型")
    public Result listParent(){
        return Result.ok(typeService.getsParent());
    }
}
